
void __attribute__((naked,noinline)) sub_FF86F820_my(){
asm volatile(
                 "STMFD   SP!, {R4-R6,LR}\n"
                 "BL      sub_FF870634\n"
                 "CMP     R0, #1\n"
                 "BLEQ    sub_FF870744\n"
                 "LDR     R4, =0x5D58\n"
                 "MOV     R5, #1\n"
                 "LDR     R0, [R4,#0x24]\n"
                 "CMP     R0, #0\n"
                 "LDRNE   R0, [R4,#0x4C]\n"
                 "CMPNE   R0, #0\n"
                 "BEQ     loc_FF86F88C\n"
                 "BL      sub_FF870634\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF86F88C\n"
                 "BL      sub_FF870744\n"
                 "LDR     R0, [R4,#0x78]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF86F88C\n"
                 "LDR     R1, =0xFF86FA50\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "BL      sub_FF9A0FC8\n"
                 "BL      sub_FF9A0F54\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, #0x51\n"
                 "BL      sub_FF879250\n"
                 "STR     R5, [R4,#0x78]\n"
 "loc_FF86F88C:\n"
                 "BL      sub_FF870634\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF86F8D8\n"
                 "LDR     R0, [R4,#0x44]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF86F8D8\n"
                 "LDR     R0, [R4,#0x74]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF86F8D8\n"
                 "LDR     R1, =0xFF86FA64\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, #0x8C\n"
                 "BL      sub_FF879250\n"
                 "BL      sub_FF877318\n"
                 "MOV     R0, #0x21\n"
                 "BL      sub_FF879290\n"
                 "STR     R5, [R4,#0x74]\n"
 "loc_FF86F8D8:\n"
                 "LDR     R0, [R4,#0x38]\n"
                 "CMP     R0, #0\n"
                 "LDRNE   R0, [R4,#0x3C]\n"
                 "CMPNE   R0, #0\n"
                 "LDRNE   R0, [R4,#0x44]\n"
                 "CMPNE   R0, #0\n"
                 "LDRNE   R0, [R4,#0x48]\n"
                 "CMPNE   R0, #0\n"
                 "LDRNE   R0, [R4,#0x1C]\n"
                 "LDRNE   R1, [R4,#0x20]\n"
                 "ORRNES  R0, R0, R1\n"
                 "BEQ     loc_FF86F914\n"
                 "BL      sub_FF86EF3C\n"
                 "BL      sub_FF86F134\n"
                 "B       loc_FF86F938\n"
 "loc_FF86F914:\n"
                 "LDR     R0, [R4,#0x58]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF86F940\n"
                 "BL      sub_FF86EFE0\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF86F940\n"
                 "BL      sub_FF871E38\n"
                 "BL      sub_FF871DF4\n"
                 "BL      sub_FF870520\n"
 "loc_FF86F938:\n"
                 "MOV     R0, #0\n"
                 "LDMFD   SP!, {R4-R6,PC}\n"
 "loc_FF86F940:\n"
                 "BL      sub_FF86EFE0\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF86F968\n"
                 "LDR     R0, [R4,#0x7C]\n"
                 "CMP     R0, #0\n"
                 "BLEQ    sub_FF870788_my\n"
                 "MOV     R0, #0\n"
                 "STR     R0, [R4,#0x70]\n"
                 "STR     R0, [R4,#0x74]\n"
                 "STR     R0, [R4,#0x78]\n"
 "loc_FF86F968:\n"
                 "MOV     R0, #1\n"
                 "LDMFD   SP!, {R4-R6,PC}\n"
);
}






void __attribute__((naked,noinline)) sub_FF870788_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R1, =0xFF8709C4\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "BL      sub_FF82C038\n"
                 "BL      sub_FF870318\n"
                 "BL      sub_FF874F04_my\n"
                 "MOV     R0, #1\n"
                 "BL      sub_FF86E9D4\n"
                 "BL      sub_FF86EEC0\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF86F194\n"
 );
} 





void __attribute__((naked,noinline)) sub_FF874F04_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R6,LR}\n"
                 "LDR     R1, =0xFF874FB8\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "LDR     R4, =0x601C\n"
                 "MOV     R0, #6\n"
                 "MOV     R5, #1\n"
                 "STR     R0, [R4,#0x70]\n"
                 "STR     R5, [R4,#0x10]\n"
                 "BL      sub_FF9478C4\n"
                 "BL      sub_FF94E2F0\n"
                 "BL      sub_FF94CB9C\n"
                 "BL      sub_FF87557C_my\n"
                 "BL      sub_FF957630\n"
                 "BL      sub_FF9556EC\n"
                 "MOV     R0, #1\n"
                 "STR     R5, [R4,#0x18]\n"
                 "BL      sub_FF87563C\n"
                 "MOV     R0, #3\n"
                 "STR     R0, [R4,#0x7C]\n"
                 "LDR     R1, [R4,#0x80]\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "MOV     R0, #0\n"
                 "BX      R1\n"
 );
} 





void __attribute__((naked,noinline)) sub_FF87557C_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R0, =0x855\n"
                 "BL      sub_FF86C914\n"
                 "BL      sub_FF82BE18\n"
                 "BL      sub_FF874CD0_my\n"
                 "BL      sub_FF9470BC\n"
                 "BL      sub_FF942054\n"
                 "BL      sub_FF94ECC8\n"
                 "BL      sub_FF94F0B0\n"
                 "BL      sub_FF9552CC\n"
                 "BL      sub_FF958B38\n"
                 "BL      sub_FF94F2A0\n"
                 "BL      sub_FF94EEB0\n"
                 "BL      sub_FF957250\n"
                 "BL      sub_FF94E8F8\n"
                 "BL      sub_FF954F40\n"
                 "BL      sub_FF956E20\n"
                 "BL      sub_FF879330\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF879160\n"
 );
} 






void __attribute__((naked,noinline)) sub_FF874CD0_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R0, =0x60A8\n"
                 "LDR     R1, =sub_FF874A98_my\n"
                 "BL      sub_FF87A904\n"
                 "LDR     R1, =0x601C\n"
                 "LDR     R0, =sub_FF874B6C_my\n"
                 "STR     R0, [R1,#0x80]\n"
                 "LDMFD   SP!, {R4,PC}\n"
 );
} 




void __attribute__((naked,noinline)) sub_FF874A98_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R6,LR}\n"
                 "LDR     R5, =0x601C\n"
                 "MOV     R4, #0\n"
                 "LDR     R0, [R5,#0x60]\n"
                 "SUB     R12, R0, #0x1000\n"
                 "SUBS    R12, R12, #0x5B\n"
                 "LDRNE   R1, [R5,#0x4C]\n"
                 "CMPNE   R1, #0\n"
                 "LDR     R1, [R5,#0x58]\n"
                 "MOVNE   R4, #2\n"
                 "CMP     R0, R1\n"
                 "BNE     loc_FF874AD4\n"
                 "LDR     R0, [R5,#0x50]\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R4, #3\n"
 "loc_FF874AD4:\n"
                 "BL      sub_FF8753E8\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF874AF8\n"
                 "CMP     R4, #0\n"
                 "BNE     loc_FF874AF8\n"
                 "LDR     R0, [R5,#0x3C]\n"
                 "CMP     R0, #0\n"
                 "BLEQ    sub_FF940CF8\n"
                 "BL      sub_FF9587F4\n"
 "loc_FF874AF8:\n"
                 "LDR     R0, [R5,#0x30]\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF874B24\n"
                 "LDR     R1, =0xFF874CF4\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "MOV     R0, #0\n"
                 "STR     R0, [R5,#0x30]\n"
                 "STR     R0, [R5,#0x2C]\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "B       sub_FF8742F4\n"
 "loc_FF874B24:\n"
                 "BL      sub_FF8753E8\n"
                 "CMP     R0, #0\n"
                 "BLNE    sub_FF8266F8\n"
                 "LDR     R0, [R5,#0x50]\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R0, #1\n"
                 "BLNE    sub_FF94841C\n"
                 "BL      sub_FF87535C\n"
                 "BL      sub_FF8753E8\n"
                 "CMP     R0, #0\n"
                 "LDRNE   R0, [R5,#0x7C]\n"
                 "BLNE    sub_FF87563C\n"
                 "MOV     R0, #3\n"
                 "STR     R0, [R5,#0x7C]\n"
                 "LDR     R1, [R5,#0x80]\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "MOV     R0, #0\n"
                 "BX      R1\n"
 );
} 




void __attribute__((naked,noinline)) sub_FF874B6C_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R6,LR}\n"
                 "LDR     R5, =0x601C\n"
                 "MOV     R4, #0\n"
                 "LDRH    R0, [R5,#4]\n"
                 "BL      sub_FF94E548\n"
                 "BL      sub_FF94CD5C\n"
                 "BL      sub_FF94F320\n"
                 "BL      sub_FF955398\n"
    
                 "BL      sub_FF94EA38\n"
                 "LDR     R0, [R5,#0x4C]\n"
                 "MOV     R1, #3\n"
                 "CMP     R0, #0\n"
                 "STRNE   R1, [R5,#0x70]\n"
                 "LDR     R2, [R5,#0x60]\n"
                 "SUB     R12, R2, #0x1000\n"
                 "SUBS    R12, R12, #0x5B\n"
                 "CMPNE   R0, #0\n"
                 "LDR     R0, [R5,#0x58]\n"
                 "MOVNE   R4, #2\n"
                 "CMP     R2, R0\n"
                 "BNE     loc_FF874BD4\n"
                 "LDR     R0, [R5,#0x50]\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R4, #3\n"
                 "STRNE   R1, [R5,#0x70]\n"
 "loc_FF874BD4:\n"
                 "MOV     R6, #0\n"
                 "STR     R6, [R5,#0x24]\n"
                 "BL      sub_FF8753E8\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R0, R4\n"
                 "BLNE    sub_FF8267E0\n"
                 "BL      sub_FF943424\n"
                 "STR     R6, [R5,#0x3C]\n"
                 "LDRH    R0, [R5,#4]\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF8737DC_my\n"	
                 "BL      sub_FF877318\n"
                 "LDR     R0, [R5,#0x74]\n"
                 "CMP     R0, #0\n"
                 "STRNE   R6, [R5,#0x74]\n"
                 "BLNE    sub_FF875214\n"
                 "LDR     R1, [R5,#0x70]\n"
                 "MOV     R0, #0x41\n"
                 "BL      sub_FF879250\n"
                 "BL      sub_FF875214\n"
                 "BL      sub_FF94CD4C\n"
                 "BL      sub_FF947A38\n"
                 "CMP     R0, #0\n"
                 "BLEQ    sub_FF94CD60\n"
                 "BL      sub_FF94E4B0\n"
                 "BL      sub_FF940B68\n"
                 "BL      sub_FF86A7F4\n"
                 "STR     R0, [R5,#0x6C]\n"
                 "STR     R6, [R5,#0x2C]\n"
                 "LDR     R0, [R5,#0x50]\n"
                 "MOV     R4, R5\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF874C70\n"
                 "LDR     R0, [R4,#0x10]\n"
                 "MOV     R1, R4\n"
                 "CMP     R0, #0\n"
                 "MOVEQ   R0, #0xFFFFFFFF\n"			
                 "STREQ   R0, [R1,#0x58]\n"
                 "STREQ   R0, [R1,#0x60]\n"
 "loc_FF874C70:\n"
                 "LDR     R0, =0x8003\n"
                 "STR     R6, [R4,#0x50]\n"
                 "BL      sub_FF86DE90\n"
                 "STRH    R0, [R4]\n"
                 "LDR     R0, =0x313D\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF86B264\n"
                 "BL      sub_FF8754F4\n"
                 "LDR     R0, [R4,#0x30]\n"
                 "CMP     R0, #1\n"
                 "STREQ   R6, [R4,#0x30]\n"
                 "LDMEQFD SP!, {R4-R6,LR}\n"
                 "BEQ     sub_FF8742F4\n"
                 "LDMFD   SP!, {R4-R6,PC}\n"
 );
} 






void __attribute__((naked,noinline)) sub_FF8737DC_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R6,LR}\n"
                 "MOV     R5, R0\n"
                 "MOV     R4, R1\n"
                 "LDR     R1, =0xFF8739F8\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "LDR     R6, =0x601C\n"
                 "LDR     R0, [R6,#0x10]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF873994\n"
                 "LDR     R0, [R6,#0x18]\n"
                 "LDR     R1, =0x820A\n"
                 "LDR     R2, =0xFFFE0000\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF87385C\n"
                 "CMP     R4, #1\n"
                 "LDMEQFD SP!, {R4-R6,PC}\n"
                 "CMP     R4, #0\n"
                 "BNE     loc_FF87385C\n"
                 "CMP     R5, R1\n"
                 "BNE     loc_FF87383C\n"
                 "BL      sub_FF875578\n"
                 "BL      sub_FF875258\n"
                 "B       loc_FF873994\n"
 "loc_FF87383C:\n"
                 "CMP     R2, R5,LSL#17\n"
                 "TSTNE   R5, #0xC00\n"
                 "BEQ     loc_FF873850\n"
                 "BL      sub_FF875300_my\n"
                 "B       loc_FF873854\n"
 "loc_FF873850:\n"
                 "BL      sub_FF8752B4\n"
 "loc_FF873854:\n"
                 "BL      sub_FF875578\n"
                 "B       loc_FF873994\n"
 "loc_FF87385C:\n"
                 "CMP     R5, R1\n"
                 "BNE     loc_FF8738B0\n"
                 "LDRH    R0, [R6,#2]\n"
                 "CMP     R0, R1\n"
                 "BEQ     loc_FF87398C\n"
                 "CMP     R2, R0,LSL#17\n"
                 "TSTNE   R0, #0xC00\n"
                 "BEQ     loc_FF873894\n"
                 "LDR     R1, =0xFF873A18\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BEQ     loc_FF873964\n"
                 "B       loc_FF8738A8\n"
 "loc_FF873894:\n"
                 "LDR     R1, =0xFF873A28\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BEQ     loc_FF873980\n"
 "loc_FF8738A8:\n"
                 "BL      sub_FF875258\n"
                 "B       loc_FF87398C\n"
 "loc_FF8738B0:\n"
                 "CMP     R2, R5,LSL#17\n"
                 "LDRH    R0, [R6,#2]\n"
                 "TSTNE   R5, #0xC00\n"
                 "BEQ     loc_FF873920\n"
                 "CMP     R0, R1\n"
                 "BNE     loc_FF8738E0\n"
                 "LDR     R1, =0xFF873A38\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BEQ     loc_FF87393C\n"
                 "B       loc_FF873918\n"
 "loc_FF8738E0:\n"
                 "CMP     R2, R0,LSL#17\n"
                 "TSTNE   R0, #0xC00\n"
                 "BEQ     loc_FF873904\n"
                 "LDR     R1, =0xFF873A48\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BEQ     loc_FF873964\n"
                 "B       loc_FF873918\n"
 "loc_FF873904:\n"
                 "LDR     R1, =0xFF873A58\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BEQ     loc_FF873980\n"
 "loc_FF873918:\n"
                 "BL      sub_FF875300_my\n"
                 "B       loc_FF87398C\n"
 "loc_FF873920:\n"
                 "CMP     R0, R1\n"
                 "BNE     loc_FF873944\n"
                 "LDR     R1, =0xFF873A68\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BNE     loc_FF873988\n"
 "loc_FF87393C:\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "B       sub_FF875288\n"
 "loc_FF873944:\n"
                 "CMP     R2, R0,LSL#17\n"
                 "TSTNE   R0, #0xC00\n"
                 "BEQ     loc_FF87396C\n"
                 "LDR     R1, =0xFF873A78\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BNE     loc_FF873988\n"
 "loc_FF873964:\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "B       sub_FF87532C\n"
 "loc_FF87396C:\n"
                 "LDR     R1, =0xFF873A88\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "CMP     R4, #1\n"
                 "BNE     loc_FF873988\n"
 "loc_FF873980:\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "B       sub_FF8752DC\n"
 "loc_FF873988:\n"
                 "BL      sub_FF8752B4\n"
 "loc_FF87398C:\n"
                 "CMP     R4, #0\n"
                 "LDMNEFD SP!, {R4-R6,PC}\n"
 "loc_FF873994:\n"
                 "STRH    R5, [R6,#2]\n"
                 "LDMFD   SP!, {R4-R6,PC}\n"
 );
} 






void __attribute__((naked,noinline)) sub_FF875300_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R1, =0xFF875464\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "LDR     R4, =0x601C\n"
                 "LDR     R0, [R4,#0x28]\n"
                 "CMP     R0, #0\n"
                 "BLNE    sub_FF875DA0\n"
                 "LDR     R0, [R4,#0x4C]\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF878420_my\n"
 );
} 





void __attribute__((naked,noinline)) sub_FF878420_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R4, =0x61DC\n"
                 "MOV     R1, #0\n"
                 "CMP     R0, #0\n"
                 "STR     R1, [R4,#0x30]\n"
                 "BEQ     loc_FF878448\n"
                 "BL      sub_FF871C90\n"
                 "BL      sub_FF878704\n"
                 "MOV     R0, #1\n"
                 "STR     R0, [R4,#0x48]\n"
 "loc_FF878448:\n"
                 "LDR     R0, [R4,#8]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF878464\n"
                 "LDR     R0, =sub_FF877EF4_my\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF86AA68\n"
                 "STR     R0, [R4,#8]\n"
 "loc_FF878464:\n"
                 "LDR     R0, [R4,#0xC]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF878480\n"
                 "LDR     R0, =0xFF877B48\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF874E74\n"
                 "STR     R0, [R4,#0xC]\n"
 "loc_FF878480:\n"
                 "BL      sub_FF878CE0\n"
                 "BL      sub_FF877BAC\n"
                 "BL      sub_FF955C84\n"
                 "BL      sub_FF95950C\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF94DC30\n"
 );
} 






void __attribute__((naked,noinline)) sub_FF877EF4_my(){ 
 asm volatile(
                 "STMFD   SP!, {R3-R11,LR}\n"
                 "LDR     R5, =0x61DC\n"
                 "MOV     R4, R1\n"
                 "LDR     R1, [R5,#0x2C]\n"
                 "ADD     R0, R5, #0\n"
                 "LDR     R0, [R0,#0x14]\n"
                 "LDR     R11, =0x3007\n"
                 "LDR     R10, =0x9A5\n"
                 "CMP     R1, #0\n"
                 "MOV     R9, R3\n"
                 "MOV    R8, #0xFFFFFFFF\n"	
                 "BEQ     loc_FF877F98\n"
                 "CMP     R4, R11\n"
                 "BEQ     loc_FF878228\n"
                 "CMP     R4, #0x800\n"
                 "LDREQ   R1, [R5,#0x3C]\n"
                 "MOVEQ   R4, R5\n"
                 "CMPEQ   R9, R1\n"
                 "BNE     loc_FF878378\n"
                 "MOV     R1, #0\n"
                 "STR     R1, [R4,#0x2C]\n"
                 "CMP     R0, #0\n"
                 "STR     R8, [R4,#0x3C]\n"
                 "BNE     loc_FF877F70\n"
                 "BL      sub_FF82C90C\n"
                 "CMP     R0, #1\n"
                 "BEQ     loc_FF877F6C\n"
                 "BL      sub_FF82C914\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF877F70\n"
 "loc_FF877F6C:\n"
                 "BL      sub_FF877D1C\n"
 "loc_FF877F70:\n"
                 "LDR     R0, [R4,#0x48]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF877F88\n"
                 "BL      sub_FF82C91C\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF8782DC\n"
 "loc_FF877F88:\n"
                 "BL      sub_FF877D1C\n"
                 "MOV     R1, #1\n"
                 "MOV     R0, R10\n"
                 "B       loc_FF878314\n"
 "loc_FF877F98:\n"
                 "CMP     R0, #1\n"
                 "SUBEQ   R12, R4, #0x2000\n"
                 "SUBEQS  R12, R12, #0x1C\n"
                 "BNE     loc_FF877FB4\n"
                 "MOV     R0, #0\n"
                 "BL      sub_FF878764\n"
                 "B       loc_FF8782DC\n"
 "loc_FF877FB4:\n"
                 "BL      sub_FF88EA4C\n"
                 "LDR     R6, =0x9A1\n"
                 "CMP     R0, #1\n"
                 "ADD     R7, R6, #2\n"
                 "BNE     loc_FF877FE4\n"
                 "CMP     R4, R10\n"
                 "CMPNE   R4, R6\n"
                 "CMPNE   R4, R7\n"
                 "BNE     loc_FF877FE4\n"
                 "BL      sub_FF88DB90\n"
                 "STR     R4, [R5,#0x40]\n"
                 "B       loc_FF878378\n"
 "loc_FF877FE4:\n"
                 "BL      sub_FF94CBA4\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF878004\n"
                 "MOV     R0, R4\n"
                 "BL      sub_FF86AFA4\n"
                 "CMP     R0, #1\n"
                 "CMPNE   R4, R10\n"
                 "BEQ     loc_FF878378\n"
 "loc_FF878004:\n"
                 "BL      sub_FF82CA24\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF87801C\n"
                 "CMP     R4, R6\n"
                 "CMPNE   R4, R7\n"
                 "BEQ     loc_FF8782DC\n"
 "loc_FF87801C:\n"
                 "BL      sub_FF874A8C\n"
                 "LDR     R1, =0x9A2\n"
                 "CMP     R0, #1\n"
                 "ADD     R2, R1, #2\n"
                 "BNE     loc_FF878044\n"
                 "CMP     R4, R6\n"
                 "CMPNE   R4, R1\n"
                 "CMPNE   R4, R7\n"
                 "CMPNE   R4, R2\n"
                 "BEQ     loc_FF8782DC\n"
 "loc_FF878044:\n"
                 "SUB     R12, R4, #0x800\n"
                 "SUBS    R12, R12, #0x57\n"
                 "BNE     loc_FF87806C\n"
                 "LDR     R0, [R5,#0x10]\n"
                 "LDR     R1, [R5,#0x14]\n"
                 "ORR     R0, R0, R1\n"
                 "LDR     R1, [R5,#0x1C]\n"
                 "ORRS    R0, R0, R1\n"
                 "BLEQ    sub_FF9914E4\n"
                 "B       loc_FF8782DC\n"
 "loc_FF87806C:\n"
                 "LDR     R12, =0x9A5\n"
                 "MOV     R10, #1\n"
                 "CMP     R4, R12\n"
                 "BEQ     loc_FF8782FC\n"
                 "BGT     loc_FF878124\n"
                 "LDR     R12, =0x907\n"
                 "CMP     R4, R12\n"
                 "MOVEQ   R1, #2\n"
                 "BEQ     loc_FF8782F4\n"
                 "BGT     loc_FF878100\n"
                 "LDR     R12, =0x829\n"
                 "LDR     R6, =0x2003\n"
                 "CMP     R4, R12\n"
                 "BEQ     loc_FF878268\n"
                 "BGT     loc_FF8780D4\n"
                 "CMP     R4, #0x800\n"
                 "BEQ     loc_FF8781F8\n"
                 "SUB     R12, R4, #0x800\n"
                 "SUBS    R12, R12, #0x26\n"
                 "BNE     loc_FF878390\n"
                 "BL      sub_FF874A8C\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF87823C\n"
                 "MOV     R0, R4\n"
                 "BL      sub_FF87505C\n"
                 "B       loc_FF8782DC\n"
 "loc_FF8780D4:\n"
                 "CMP     R4, #0x860\n"
                 "BEQ     loc_FF8782B8\n"
                 "SUB     R12, R4, #0x800\n"
                 "SUBS    R12, R12, #0x61\n"
                 "BNE     loc_FF878390\n"
                 "BL      sub_FF878878\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF878378\n"
                 "LDR     R0, =0x9A6\n"
                 "MOV     R1, R9\n"
                 "B       loc_FF878334\n"
 "loc_FF878100:\n"
                 "CMP     R4, R6\n"
                 "BEQ     loc_FF87830C\n"
                 "CMP     R4, R1\n"
                 "BEQ     loc_FF8783DC\n"
                 "CMP     R4, R7\n"
                 "BEQ     loc_FF87830C\n"
                 "CMP     R4, R2\n"
                 "BEQ     loc_FF8783DC\n"
                 "B       loc_FF878390\n"
 "loc_FF878124:\n"
                 "LDR     R12, =0x3149\n"
                 "CMP     R4, R12\n"
                 "MOVEQ   R1, #0\n"
                 "MOVEQ   R0, #0x84\n"
                 "BEQ     loc_FF878388\n"
                 "BGT     loc_FF878190\n"
                 "CMP     R4, R11\n"
                 "BEQ     loc_FF878218\n"
                 "BGT     loc_FF87816C\n"
                 "SUB     R12, R4, #0x2000\n"
                 "SUBS    R12, R12, #0xA\n"
                 "BEQ     loc_FF8783DC\n"
                 "SUB     R12, R4, #0x2000\n"
                 "SUBS    R12, R12, #0x20\n"
                 "BNE     loc_FF878390\n"
                 "MOV     R1, R9\n"
                 "MOV     R0, #0x83\n"
                 "B       loc_FF878388\n"
 "loc_FF87816C:\n"
                 "SUB     R12, R4, #0x3100\n"
                 "SUBS    R12, R12, #0x35\n"
                 "BEQ     loc_FF8781CC\n"
                 "SUB     R12, R4, #0x3000\n"
                 "SUBS    R12, R12, #0x148\n"
                 "BNE     loc_FF878390\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, #0x86\n"
                 "B       loc_FF878388\n"
 "loc_FF878190:\n"
                 "SUB     R12, R4, #0x3100\n"
                 "SUBS    R12, R12, #0x4A\n"
                 "BEQ     loc_FF878380\n"
                 "SUB     R12, R4, #0x4000\n"
                 "SUBS    R12, R12, #3\n"
                 "BEQ     loc_FF87833C\n"
                 "SUB     R12, R4, #0x4000\n"
                 "SUBS    R12, R12, #8\n"
                 "BEQ     loc_FF87831C\n"
                 "SUB     R12, R4, #0x4000\n"
                 "SUBS    R12, R12, #0xF\n"
                 "BNE     loc_FF878390\n"
                 "MOV     R0, #0x82\n"
                 "BL      sub_FF879290\n"
                 "B       loc_FF8782DC\n"
 "loc_FF8781CC:\n"
                 "BL      sub_FF878D14\n"
                 "CMP     R0, #4\n"
                 "BEQ     loc_FF8783DC\n"
                 "LDR     R0, [R5,#0x1C]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF8782DC\n"
                 "LDR     R0, [R5,#0x48]\n"
                 "CMP     R0, #0\n"
                 "BLNE    sub_FF877CF0\n"
                 "BL      sub_FF877C44\n"
                 "B       loc_FF8782DC\n"
 "loc_FF8781F8:\n"
                 "LDR     R0, [R5,#0x4C]\n"
                 "CMP     R9, R0\n"
                 "BNE     loc_FF878378\n"
                 "LDR     R1, =0xFF87840C\n"
                 "MOV     R0, #0x20\n"
                 "BL      sub_FF867A8C\n"
                 "STR     R8, [R5,#0x4C]\n"
                 "B       loc_FF878378\n"
 "loc_FF878218:\n"
                 "STR     R10, [R5,#0x1C]\n"
                 "LDR     R0, [R5,#0x18]\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF878230\n"
 "loc_FF878228:\n"
                 "BL      sub_FF877C44\n"
                 "LDMFD   SP!, {R3-R11,PC}\n"
 "loc_FF878230:\n"
                 "MOV     R0, R4\n"
                 "BL      sub_FF877EB8\n"
                 "B       loc_FF8782DC\n"
 "loc_FF87823C:\n"
                 "LDR     R0, [R5,#0x10]\n"
                 "LDR     R1, [R5,#0x14]\n"
                 "ORR     R0, R0, R1\n"
                 "LDR     R1, [R5,#0x1C]\n"
                 "ORRS    R0, R0, R1\n"
                 "BNE     loc_FF8782DC\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, R6\n"
                 "BL      sub_FF85985C\n"
                 "BL      sub_FF9830FC\n"
                 "B       loc_FF8782DC\n"
 "loc_FF878268:\n"
                 "LDR     R0, [R5,#0x10]\n"
                 "LDR     R1, [R5,#0x14]\n"
                 "ORRS    R0, R0, R1\n"
                 "BNE     loc_FF8782DC\n"
                 "BL      sub_FF875068\n"
                 "CMP     R0, #0\n"
                 "LDREQ   R0, [R5,#0x1C]\n"
                 "CMPEQ   R0, #0\n"
                 "BNE     loc_FF8782DC\n"
                 "BL      sub_FF874A8C\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF8782DC\n"
                 "BL      sub_FF958E90\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF8782DC\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, R6\n"
                 "BL      sub_FF85985C\n"
                 "BL      sub_FF94199C\n"
                 "B       loc_FF8782DC\n"
 "loc_FF8782B8:\n"
                 "BL      sub_FF878878\n"
                 "CMP     R0, #2\n"
                 "BEQ     loc_FF878378\n"
                 "BL      sub_FF878878\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF878378\n"
                 "LDR     R0, [R5,#0x4C]\n"
                 "CMN     R0, #1\n"
                 "BEQ     loc_FF8782E4\n"
 "loc_FF8782DC:\n"
                 "MOV     R0, #0\n"
                 "LDMFD   SP!, {R3-R11,PC}\n"
 "loc_FF8782E4:\n"
                 "LDR     R0, [R5,#0x34]\n"
                 "CMP     R0, #0\n"
                 "STREQ   R10, [R5,#0x38]\n"
 "loc_FF8782F0:\n"
                 "MOV     R1, #1\n"
 "loc_FF8782F4:\n"
                 "LDR     R0, =0x9A5\n"
                 "B       loc_FF878314\n"
 "loc_FF8782FC:\n"
                 "LDR     R0, [R5,#0x4C]\n"
                 "CMN     R0, #1\n"
                 "BEQ     loc_FF8782F0\n"
                 "B       loc_FF8782DC\n"
 "loc_FF87830C:\n"
                 "MOV     R1, #1\n"
                 "MOV     R0, R4\n"
 "loc_FF878314:\n"
                 "BL      sub_FF877D8C_my\n" 
                 "LDMFD   SP!, {R3-R11,PC}\n"
 "loc_FF87831C:\n"
                 "MOV     R0, R9\n"
                 "BL      sub_FF872758\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF878378\n"
                 "MOV     R1, R9\n"
                 "MOV     R0, R4\n"
 "loc_FF878334:\n"
                 "BL      sub_FF878970_my\n" 
                 "B       loc_FF878378\n"
 "loc_FF87833C:\n"
                 "LDR     R0, [R5,#0x40]\n"
                 "CMN     R0, #1\n"
                 "BEQ     loc_FF878378\n"
                 "MOV     R0, #0\n"
                 "BL      sub_FF88A684\n"
                 "LDR     R0, [R5,#0x40]\n"
                 "CMP     R0, R6\n"
                 "BNE     loc_FF878368\n"
                 "BL      sub_FF82C90C\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF878374\n"
 "loc_FF878368:\n"
                 "LDR     R0, [R5,#0x40]\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF86B218\n"
 "loc_FF878374:\n"
                 "STR     R8, [R5,#0x40]\n"
 "loc_FF878378:\n"
                 "MOV     R0, #1\n"
                 "LDMFD   SP!, {R3-R11,PC}\n"
 "loc_FF878380:\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, #0x85\n"
 "loc_FF878388:\n"
                 "BL      sub_FF879250\n"
                 "B       loc_FF8782DC\n"
 "loc_FF878390:\n"
                 "LDR     R12, =0x855\n"
                 "CMP     R4, R12\n"
                 "BEQ     loc_FF8783CC\n"
                 "BGT     loc_FF8783B8\n"
                 "SUB     R12, R4, #0x800\n"
                 "SUBS    R12, R12, #0x38\n"
                 "SUBNE   R12, R4, #0x800\n"
                 "SUBNES  R12, R12, #0x39\n"
                 "BNE     loc_FF8783DC\n"
                 "B       loc_FF8783CC\n"
 "loc_FF8783B8:\n"
                 "SUB     R12, R4, #0x800\n"
                 "SUBS    R12, R12, #0x56\n"
                 "SUBNE   R12, R4, #0x800\n"
                 "SUBNES  R12, R12, #0x5D\n"
                 "BNE     loc_FF8783DC\n"
 "loc_FF8783CC:\n"
                 "LDR     R0, [R5,#0x10]\n"
                 "LDR     R1, [R5,#0x14]\n"
                 "ORRS    R0, R0, R1\n"
                 "BNE     loc_FF8782DC\n"
 "loc_FF8783DC:\n"
                 "MOV     R1, R9\n"
                 "MOV     R0, R4\n"
                 "BL      sub_FF878970_my\n" 
                 "LDMFD   SP!, {R3-R11,PC}\n"
 );
} 






void __attribute__((naked,noinline)) sub_FF877D8C_my(){
asm volatile(
                 "STMFD   SP!, {R4-R6,LR}\n"
                 "MOV     R4, R0\n"
                 "LDR     R0, =0x61DC\n"
                 "MOV     R5, R1\n"
                 "LDR     R0, [R0,#0x1C]\n"
                 "CMP     R0, #0\n"
                 "LDRNE   R1, =0xFF877E94\n"
                 "BNE     loc_FF877E40\n"
                 "BL      sub_FF878D20\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF877DC8\n"
 "loc_FF877DB8:\n"
                 "MOV     R0, R4\n"
                 "LDMFD   SP!, {R4-R6,LR}\n"
                 "MOV     R1, #0\n"
                 "B       sub_FF878970_my\n" 
 "loc_FF877DC8:\n"
                 "CMP     R5, #2\n"
                 "BNE     loc_FF877DE0\n"
                 "BL      sub_FF878750\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF877E30\n"
                 "B       loc_FF877DFC\n"
 "loc_FF877DE0:\n"
                 "CMP     R5, #1\n"
                 "BNE     loc_FF877E30\n"
                 "LDR     R0, =0xA22\n"
                 "BL      sub_FF877670\n"
                 "BL      sub_FF877330\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF877E30\n"
 "loc_FF877DFC:\n"
                 "MOV     R0, #0\n"
                 "BL      sub_FF88A684\n"
                 "SUB     R12, R4, #0x900\n"
                 "SUBS    R12, R12, #0xA1\n"
                 "SUBNE   R12, R4, #0x900\n"
                 "SUBNES  R12, R12, #0xA3\n"
                 "SUBNE   R12, R4, #0x900\n"
                 "SUBNES  R12, R12, #0xA5\n"
                 "LDREQ   R0, =0xC507\n"
                 "MOVEQ   R1, #0\n"
                 "BLEQ    sub_FF85985C\n"
 "loc_FF877E28:\n"
                 "MOV     R0, #0\n"
                 "LDMFD   SP!, {R4-R6,PC}\n"
 "loc_FF877E30:\n"
                 "BL      sub_FF877D1C\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF877E4C\n"
                 "LDR     R1, =0xFF877EA4\n"
 "loc_FF877E40:\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "B       loc_FF877E28\n"
 "loc_FF877E4C:\n"
                 "MOV     R0, R5\n"
                 "BL      sub_FF94BBD8\n"
                 "B       loc_FF877DB8\n"
 );
}








void __attribute__((naked,noinline)) sub_FF878970_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R8,LR}\n"
                 "MOV     R7, R1\n"
                 "MOV     R4, R0\n"
                 "BL      sub_FF878D9C\n"
                 "LDR     R5, =0x622C\n"
                 "LDR     R3, =0x201F\n"
                 "LDR     R12, [R5]\n"
                 "LDR     R2, =0x4008\n"
                 "LDR     R6, =0x9A3\n"
                 "LDR     R0, =0x3007\n"
                 "LDR     R1, =0x1051\n"
                 "CMP     R12, #9\n"
                 "SUB     LR, R3, #0x15\n"
                 "ADDLS   PC, PC, R12,LSL#2\n"
                 "B       loc_FF878CD8\n"
 "loc_FF8789AC:\n"
                 "B       loc_FF8789D4\n"
 "loc_FF8789B0:\n"
                 "B       loc_FF8789E4\n"
 "loc_FF8789B4:\n"
                 "B       loc_FF8789F4\n"
 "loc_FF8789B8:\n"
                 "B       loc_FF878A68\n"
 "loc_FF8789BC:\n"
                 "B       loc_FF878AA8\n"
 "loc_FF8789C0:\n"
                 "B       loc_FF878B38\n"
 "loc_FF8789C4:\n"
                 "B       loc_FF878BD4\n"
 "loc_FF8789C8:\n"
                 "B       loc_FF878C20\n"
 "loc_FF8789CC:\n"
                 "B       loc_FF878BE4\n"
 "loc_FF8789D0:\n"
                 "B       loc_FF878C48\n"
 "loc_FF8789D4:\n"
                 "MOV     R1, R7\n"
                 "MOV     R0, R4\n"
                 "LDMFD   SP!, {R4-R8,LR}\n"
                 "B       sub_FF8788F0\n"
 "loc_FF8789E4:\n"
                 "MOV     R1, R7\n"
                 "MOV     R0, R4\n"
                 "LDMFD   SP!, {R4-R8,LR}\n"
                 "B       sub_FF878F38_my\n"  
 "loc_FF8789F4:\n"
                 "CMP     R4, R1\n"
                 "BEQ     loc_FF878A58\n"
                 "SUB     R12, R4, #0x2000\n"
                 "SUBS    R12, R12, #6\n"
                 "BEQ     loc_FF878A1C\n"
                 "CMP     R4, R0\n"
                 "BEQ     loc_FF878A60\n"
                 "SUB     R12, R4, #0x3100\n"
                 "SUBS    R12, R12, #0x4B\n"
                 "BNE     loc_FF878CD8\n"
 "loc_FF878A1C:\n"
                 "BL      sub_FF877CF0\n"
                 "MOV     R0, #0\n"
                 "BL      sub_FF878D84\n"
                 "LDR     R0, [R5,#8]\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R1, #0\n"
                 "MOVNE   R0, R6\n"
                 "BNE     loc_FF878A50\n"
                 "LDR     R0, [R5,#4]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF878C88\n"
                 "LDR     R0, =0x9A1\n"
                 "MOV     R1, #0\n"
 "loc_FF878A50:\n"
                 "BL      sub_FF8788F0\n"
                 "B       loc_FF878C88\n"
 "loc_FF878A58:\n"
                 "BL      sub_FF878E8C\n"
                 "B       loc_FF878C88\n"
 "loc_FF878A60:\n"
                 "BL      sub_FF878EC4\n"
                 "B       loc_FF878C88\n"
 "loc_FF878A68:\n"
                 "SUB     R12, R4, #0x900\n"
                 "SUBS    R12, R12, #0xA2\n"
                 "BEQ     loc_FF878A98\n"
                 "CMP     R4, R6\n"
                 "BEQ     loc_FF878A90\n"
                 "CMP     R4, R1\n"
                 "BEQ     loc_FF878AA0\n"
                 "CMP     R4, R0\n"
                 "BLEQ    sub_FF878EC4\n"
                 "B       loc_FF878CD8\n"
 "loc_FF878A90:\n"
                 "BL      sub_FF878894_my\n"  
                 "B       loc_FF878CD8\n"
 "loc_FF878A98:\n"
                 "BL      sub_FF878E6C\n"
                 "B       loc_FF878CD8\n"
 "loc_FF878AA0:\n"
                 "BL      sub_FF878E8C\n"
                 "B       loc_FF878CD8\n"
 "loc_FF878AA8:\n"
                 "CMP     R4, LR\n"
                 "BEQ     loc_FF878B18\n"
                 "BGT     loc_FF878AD8\n"
                 "CMP     R4, R6\n"
                 "SUBNE   R12, R4, #0x900\n"
                 "SUBNES  R12, R12, #0xA5\n"
                 "BEQ     loc_FF878AF4\n"
                 "CMP     R4, R1\n"
                 "BNE     loc_FF878CD8\n"
                 "BL      sub_FF828508\n"
                 "BL      sub_FF878F14\n"
                 "B       loc_FF878BDC\n"
 "loc_FF878AD8:\n"
                 "CMP     R4, R3\n"
                 "BEQ     loc_FF878B0C\n"
                 "CMP     R4, R0\n"
                 "BEQ     loc_FF878B24\n"
 "loc_FF878AE8:\n"
                 "CMP     R4, R2\n"
                 "BNE     loc_FF878CD8\n"
                 "B       loc_FF878B18\n"
 "loc_FF878AF4:\n"
                 "BL      sub_FF828508\n"
                 "MOV     R0, #5\n"
                 "BL      sub_FF878D84\n"
                 "MOV     R0, #0\n"
                 "STR     R0, [R5,#0xC]\n"
                 "B       loc_FF878C88\n"
 "loc_FF878B0C:\n"
                 "MOV     R0, #5\n"
                 "BL      sub_FF878D84\n"
                 "B       loc_FF878B64\n"
 "loc_FF878B18:\n"
                 "BL      sub_FF878F14\n"
                 "BL      sub_FF878E6C\n"
                 "B       loc_FF878C88\n"
 "loc_FF878B24:\n"
                 "BL      sub_FF828508\n"
                 "BL      sub_FF878F14\n"
                 "B       loc_FF878C18\n"
 "loc_FF878B30:\n"
                 "BL      sub_FF878D84\n"
                 "B       loc_FF878C88\n"
 "loc_FF878B38:\n"
                 "CMP     R4, R3\n"
                 "BEQ     loc_FF878B64\n"
                 "BGT     loc_FF878B58\n"
                 "CMP     R4, R1\n"
                 "BEQ     loc_FF878BDC\n"
                 "CMP     R4, LR\n"
                 "BEQ     loc_FF878B18\n"
                 "B       loc_FF878CD8\n"
 "loc_FF878B58:\n"
                 "CMP     R4, R0\n"
                 "BNE     loc_FF878AE8\n"
                 "B       loc_FF878C18\n"
 "loc_FF878B64:\n"
                 "MOV     R0, R7\n"
                 "BL      sub_FF878EE0\n"
                 "B       loc_FF878C88\n"
 "loc_FF878BD4:\n"
                 "CMP     R4, R1\n"
                 "BNE     loc_FF878CD8\n"
 "loc_FF878BDC:\n"
                 "MOV     R0, #8\n"
                 "B       loc_FF878B30\n"
 "loc_FF878BE4:\n"
                 "CMP     R4, R0\n"
                 "BEQ     loc_FF878C18\n"
                 "BGT     loc_FF878C04\n"
                 "CMP     R4, LR\n"
                 "BEQ     loc_FF878A58\n"
                 "CMP     R4, R3\n"
                 "BEQ     loc_FF878B64\n"
                 "B       loc_FF878CD8\n"
 "loc_FF878C04:\n"
                 "CMP     R4, R2\n"
                 "SUBNE   R12, R4, #0x4000\n"
                 "SUBNES  R12, R12, #0xE\n"
                 "BEQ     loc_FF878A58\n"
                 "B       loc_FF878CD8\n"
 "loc_FF878C18:\n"
                 "MOV     R0, #7\n"
                 "B       loc_FF878B30\n"
 "loc_FF878C20:\n"
                 "CMP     R4, LR\n"
                 "BEQ     loc_FF878C38\n"
                 "CMP     R4, R3\n"
                 "BEQ     loc_FF878B64\n"
                 "CMP     R4, R2\n"
                 "BNE     loc_FF878CD8\n"
 "loc_FF878C38:\n"
                 "BL      sub_FF878E6C\n"
                 "MOV     R0, #0\n"
                 "BL      sub_FF877EB8\n"
                 "B       loc_FF878C88\n"
 "loc_FF878C48:\n"
                 "SUB     R12, R4, #0x800\n"
                 "SUBS    R12, R12, #0x4A\n"
                 "BEQ     loc_FF878C90\n"
                 "CMP     R4, R1\n"
                 "BEQ     loc_FF878CC8\n"
                 "CMP     R4, R0\n"
                 "BEQ     loc_FF878CB8\n"
                 "SUB     R12, R4, #0x3100\n"
                 "SUBS    R12, R12, #0x2A\n"
                 "BNE     loc_FF878CD8\n"
                 "BL      sub_FF878E24\n"
                 "LDR     R0, [R5,#0x14]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF878C88\n"
                 "BL      sub_FF878E40_my\n"   
                 "BL      sub_FF94CBB0\n"
 "loc_FF878C88:\n"
                 "MOV     R0, #0\n"
                 "LDMFD   SP!, {R4-R8,PC}\n"
 "loc_FF878C90:\n"
                 "BL      sub_FF878E24\n"
                 "LDR     R0, =0x8007\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF86DE84\n"
                 "BL      sub_FF94BB8C\n"
                 "BL      sub_FF878E6C\n"
                 "BL      sub_FF94CBB0\n"
                 "BL      sub_FF877CF0\n"
                 "MOV     R0, #0\n"
                 "B       loc_FF878B30\n"
 "loc_FF878CB8:\n"
                 "BL      sub_FF878E24\n"
                 "BL      sub_FF94BB8C\n"
                 "BL      sub_FF94CBB0\n"
                 "B       loc_FF878A60\n"
 "loc_FF878CC8:\n"
                 "BL      sub_FF878E24\n"
                 "BL      sub_FF94BB8C\n"
                 "BL      sub_FF94CBB0\n"
                 "B       loc_FF878A58\n"
 "loc_FF878CD8:\n"
                 "MOV     R0, #1\n"
                 "LDMFD   SP!, {R4-R8,PC}\n"
                ".ltorg\n"  
 );
} 








void __attribute__((naked,noinline)) sub_FF878F38_my(){ 
 asm volatile(
                 "LDR     R3, =0x622C\n"
                 "LDR     R12, =0x2006\n"
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R1, [R3,#0xC]\n"
                 "LDR     R2, [R3,#0x14]\n"
                 "CMP     R0, R12\n"
                 "BEQ     loc_FF878FAC\n"
                 "BGT     loc_FF878F78\n"
                 "SUB     R12, R0, #0x900\n"
                 "SUBS    R12, R12, #0xA2\n"
                 "BEQ     loc_FF878FD0\n"
                 "SUB     R12, R0, #0x1000\n"
                 "SUBS    R12, R12, #0x51\n"
                 "BNE     loc_FF878FF4\n"
                 "BL      sub_FF878E8C\n"
                 "B       loc_FF878FEC\n"
 "loc_FF878F78:\n"
                 "SUB     R12, R0, #0x3000\n"
                 "SUBS    R12, R12, #7\n"
                 "BEQ     loc_FF878FE8\n"
                 "SUB     R12, R0, #0x3100\n"
                 "SUBS    R12, R12, #0x4B\n"
                 "BNE     loc_FF878FF4\n"
                 "CMP     R2, #0\n"
                 "BNE     loc_FF878FEC\n"
                 "LDR     R0, [R3,#8]\n"
                 "ORRS    R0, R0, R1\n"
                 "BEQ     loc_FF878FB8\n"
                 "BL      sub_FF878894_my\n"  
                 "B       loc_FF878FEC\n"
 "loc_FF878FAC:\n"
                 "CMP     R2, #0\n"
                 "BLEQ    sub_FF877350\n"
                 "B       loc_FF878FEC\n"
 "loc_FF878FB8:\n"
                 "LDR     R0, [R3,#4]\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R0, #3\n"
                 "BNE     loc_FF878FE0\n"
                 "BL      sub_FF878E6C\n"
                 "B       loc_FF878FEC\n"
 "loc_FF878FD0:\n"
                 "CMP     R1, #0\n"
                 "BNE     loc_FF878FEC\n"
                 "BL      sub_FF828030\n"
                 "MOV     R0, #2\n"
 "loc_FF878FE0:\n"
                 "BL      sub_FF878D84\n"
                 "B       loc_FF878FEC\n"
 "loc_FF878FE8:\n"
                 "BL      sub_FF878EC4\n"
 "loc_FF878FEC:\n"
                 "MOV     R0, #0\n"
                 "LDMFD   SP!, {R4,PC}\n"
 "loc_FF878FF4:\n"
                 "MOV     R0, #1\n"
                 "LDMFD   SP!, {R4,PC}\n"
 );
} 





void __attribute__((naked,noinline)) sub_FF878894_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R1, =0xFF878B70\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "LDR     R4, =0x622C\n"
                 "LDR     R0, [R4,#0x10]\n"
                 "CMP     R0, #0\n"
                 "LDMEQFD SP!, {R4,LR}\n"
                 "BEQ     sub_FF878E40_my\n"
                 "LDR     R1, =0xFF878B8C\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "BL      sub_FF94CBDC\n"
                 "LDR     R0, [R4,#0x18]\n"
                 "CMP     R0, #1\n"
                 "MOVNE   R0, #1\n"
                 "STRNE   R0, [R4,#0x18]\n"
                 "BLNE    sub_FF86D3D0\n"
                 "MOV     R0, #9\n"
                 "BL      sub_FF878D84\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF94BA48\n"
 );
} 





void __attribute__((naked,noinline)) sub_FF878E40_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "LDR     R1, =0xFF879014\n"
                 "MOV     R0, #0x60\n"
                 "BL      sub_FF867A8C\n"
                 "LDR     R1, =0x622C\n"
                 "MOV     R0, #0\n"
                 "STR     R0, [R1,#0xC]\n"
                 "MOV     R0, #4\n"
                 "BL      sub_FF878D84\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF878504_my\n"
 );
} 

void __attribute__((naked,noinline)) sub_FF878504_my(){ 
 asm volatile(
                 "STMFD   SP!, {R3-R5,LR}\n"
                 "LDR     R4, =0x61DC\n"
                 "LDR     R0, [R4,#0x44]\n"
                 "CMP     R0, #1\n"
                 "BEQ     loc_FF87854C\n"
                 "BL      sub_FF86DE80\n"
                 "SUB     R12, R0, #0xA00\n"
                 "SUBS    R12, R12, #0x29\n"
                 "MOV     R5, #1\n"
                 "BNE     loc_FF878544\n"
                 "LDR     R0, =0x804F\n"
                 "MOV     R2, #1\n"
                 "MOV     R1, #1\n"
                 "BL      sub_FF86DE88\n"
                 "STR     R5, [R4,#0x44]\n"
                 "B       loc_FF87854C\n"
 "loc_FF878544:\n"
                 "STR     R5, [R4,#0x44]\n"
                 "BL      sub_FF86D3D0\n"
 "loc_FF87854C:\n"
                 "MOV     R1, #0\n"
                 "MOV     R0, #0x80\n"
                 "BL      sub_FF879250\n"
                 "MOV     R2, #2\n"
                 "MOV     R1, SP\n"
                 "MOV     R0, #0x6B\n"
                 "BL      sub_FF8697F4\n"
                 "MOV     R2, #2\n"
                 "MOV     R1, SP\n"
                 "MOV     R0, #0xA3\n"
                 "BL      sub_FF8696EC\n"
                 "BL      sub_FF859908\n"
                 "BL      sub_FF87752C\n"
                 "BL      sub_FF8284D0_my\n"
                 "BL      sub_FF86A7F4\n"
                 "STR     R0, [R4,#0x4C]\n"
                 "BL      sub_FF877CA8\n"
                 "LDMFD   SP!, {R3-R5,PC}\n"
 );
} 





void __attribute__((naked,noinline)) sub_FF8284D0_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4,LR}\n"
                 "MOV     R4, R0\n"
                 "MOV     R0, #0x20\n"
                 "LDR     R1, =0xFF8286FC\n"
                 "BL      sub_FF867A8C\n"
                 "BL      sub_FF828A58\n"
                 "CMP     R0, #0\n"
                 "LDMNEFD SP!, {R4,PC}\n"
                 "MOV     R0, #4\n"
                 "BL      sub_FF8569D8\n"
                 "BL      sub_FF85B044\n"
                 "MOV     R0, R4\n"
                 "LDMFD   SP!, {R4,LR}\n"
                 "B       sub_FF85D138_my\n"
 );
} 








void __attribute__((naked,noinline)) sub_FF85D138_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R8,LR}\n"
                 "MOV     R8, R0\n"
                 "MOV     R0, #0x41\n"
                 "SUB     SP, SP, #0x38\n"
                 "MOV     R5, #0\n"
                 "STR     R0, [SP,#0x34]\n"
                 "BL      sub_FF85D108\n"
                 "CMP     R0, #0\n"
                 "LDRNE   R1, =0x13B\n"
                 "BNE     loc_FF85D2E4\n"
                 "LDR     R4, =0x5684\n"
                 "MOV     R1, #0x1E\n"
                 "LDR     R0, [R4,#0xC]\n"
                 "BL      sub_FF828E88\n"
                 "BL      sub_FF869984\n"
                 "STR     R0, [R4,#4]\n"
                 "MOV     R0, #0\n"
                 "BL      sub_FF865AC8\n"
                 "STR     R0, [SP,#0x28]\n"
                 "ADD     R0, SP, #0x28\n"
                 "MOV     R1, SP\n"
                 "BL      sub_FF8655C4\n"
                 "MOV     R0, SP\n"
                 "BL      sub_FF8654AC\n"
                 "STR     R0, [SP,#0x2C]\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #4\n"
                 "ADD     R2, SP, #0x2C\n"
                 "MOV     R1, #0x34\n"
                 "BL      sub_FF869CA4\n"
                 "LDR     R7, [SP,#0x2C]\n"
                 "BL      sub_FF85D660\n"
                 "MOV     R6, #0\n"
                 "ADD     R1, SP, #0x28\n"
                 "ADD     R0, SP, #0x2C\n"
                 "STR     R6, [SP,#0x2C]\n"
                 "STR     R6, [SP,#0x28]\n"
                 "BL      sub_FF831DF8\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #2\n"
                 "ADD     R2, SP, #0x2C\n"
                 "MOV     R1, #0x2F\n"
                 "BL      sub_FF869CA4\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #2\n"
                 "ADD     R2, SP, #0x28\n"
                 "MOV     R1, #0x2D\n"
                 "BL      sub_FF869CA4\n"
                 "ADD     R1, SP, #0x28\n"
                 "ADD     R0, SP, #0x2C\n"
                 "BL      sub_FF835558\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #2\n"
                 "ADD     R2, SP, #0x2C\n"
                 "MOV     R1, #0x30\n"
                 "BL      sub_FF869CA4\n"
                 "ADD     R1, SP, #0x28\n"
                 "ADD     R0, SP, #0x2C\n"
                 "BL      sub_FF8325BC\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #2\n"
                 "ADD     R2, SP, #0x28\n"
                 "MOV     R1, #0x2E\n"
                 "BL      sub_FF869CA4\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #2\n"
                 "ADD     R2, SP, #0x2C\n"
                 "MOV     R1, #0xB8\n"
                 "BL      sub_FF869D50\n"
                 "TST     R0, #1\n"
                 "LDRNE   R1, =0x11D\n"
                 "LDRNE   R0, =0xFF85D55C\n"
                 "BLNE    sub_FF81BFC8\n"
                 "LDRH    R0, [SP,#0x2C]\n"
                 "MOV     R3, #4\n"
                 "ADD     R2, SP, #0x28\n"
                 "CMP     R0, #0\n"
                 "MOVNE   R0, #1\n"
                 "STR     R0, [SP,#0x28]\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R1, #0x92\n"
                 "BL      sub_FF869CA4\n"
                 "MOV     R2, #1\n"
                 "ADD     R1, SP, #0x34\n"
                 "MOV     R0, #0xFA\n"
                 "BL      sub_FF8697F4\n"
                 "TST     R0, #1\n"
                 "LDRNE   R1, =0x152\n"
                 "LDRNE   R0, =0xFF85D55C\n"
                 "BLNE    sub_FF81BFC8\n"
                 "LDRB    R0, [SP,#0x34]\n"
                 "MOV     R3, R8\n"
                 "MOV     R2, #0x14\n"
                 "AND     R1, R0, #0xFF\n"
                 "ADD     R0, SP, #0x30\n"
                 "STR     R7, [SP,#0x0]\n"
                 "BL      sub_FF90A9C4\n"
                 "TST     R0, #1\n"
                 "LDRNE   R1, =0x156\n"
                 "BNE     loc_FF85D2E4\n"
                 "LDR     R0, =0x1DAD0\n"
                 "LDR     R1, [SP,#0x30]\n"
                 "MOV     R2, #0x10\n"
                 "BL      sub_FF8FDDE8\n"
                 "TST     R0, #1\n"
                 "BEQ     loc_FF85D2F4\n"
                 "LDR     R1, =0x15E\n"
 "loc_FF85D2E4:\n"
                 "LDR     R0, =0xFF85D55C\n"
                 "BL      sub_FF81BFC8\n"
 "loc_FF85D2EC:\n"
                 "ADD     SP, SP, #0x38\n"
                 "LDMFD   SP!, {R4-R8,PC}\n"
 "loc_FF85D2F4:\n"
                 "LDR     R0, [R4,#4]\n"
                 "MOV     R3, #4\n"
                 "ADD     R2, SP, #0x30\n"
                 "MOV     R1, #0x2B\n"
                 "BL      sub_FF869CA4\n"
                 "BL      sub_FF87A218\n"
                 "LDRSB   R1, [SP,#0x34]\n"
                 "CMP     R0, R1\n"
                 "MOVEQ   R7, #0\n"
                 "BEQ     loc_FF85D348\n"
                 "LDR     R5, =0x1DAD0\n"
                 "MOV     R0, R5\n"
                 "BL      sub_FF87A394\n"
                 "MOV     R8, R0\n"
                 "BL      sub_FF8B3DBC\n"
                 "CMP     R8, R0\n"
                 "MOV     R7, R0\n"
                 "LDRLS   R1, =0x16B\n"
                 "LDRLS   R0, =0xFF85D55C\n"
                 "BLLS    sub_FF81BFC8\n"
                 "SUB     R7, R8, R7\n"
 "loc_FF85D348:\n"
                 "BL      sub_FF8585F4_my\n"
                 "LDR     R0, =0x1DAF4\n"
                 "LDRH    R3, [R0,#0x4E]\n"
                 "LDRH    R2, [R0,#0x4C]\n"
                 "LDR     R1, [R0,#0x48]\n"
                 "LDR     R0, [R0,#0x44]\n"
                 "BL      sub_FF857478\n"
                 "MOV     R3, #0\n"
                 "LDR     R2, =0xFF85D0D0\n"
                 "MOV     R1, #0\n"
                 "LDR     R0, =0xFF85D0E4\n"
                 "ADD     R8, SP, #0xC\n"
                 "STMIA   R8, {R0-R3}\n"
                 "LDR     R2, =0xFF85D0F4\n"
                 "LDR     R1, =0xFF85D0E0\n"
                 "STMEA   SP, {R1-R3}\n"
                 "LDR     R1, [R4,#4]\n"
                 "MOV     R3, R6\n"
                 "MOV     R2, R7\n"
                 "MOV     R0, R5\n"
                 "BL      sub_FF8577F4\n"
                 "LDR     R0, [R4,#0xC]\n"
                 "MOV     R1, #0x20\n"
                 "BL      sub_FF828E54\n"
                 "B       loc_FF85D2EC\n"
 );
} 


void __attribute__((naked,noinline)) sub_FF8585F4_my(){ 
 asm volatile(
                 "STMFD   SP!, {R3-R9,LR}\n"
                 "LDR     R5, =0x54E8\n"
                 "MOV     R6, #0\n"
                 "STR     R6, [R5,#0x24]\n"
                 "LDR     R0, [R5,#8]\n"
                 "LDR     R8, =0x2710\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF8586AC\n"
                 "MOV     R0, #1\n"
                 "STR     R0, [R5,#8]\n"
                 "MOV     R0, #0\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF81BE44\n"
                 "STR     R0, [R5,#0x14]\n"
                 "MOV     R0, #0\n"
                 "MOV     R1, #0\n"
                 "BL      sub_FF81BE44\n"
                 "STR     R0, [R5,#0x18]\n"
                 "MOV     R0, #0\n"
                 "MOV     R1, #0xA\n"
                 "BL      sub_FF81BDFC\n"
                 "STR     R0, [R5,#0x1C]\n"
                 "MOV     R0, #0\n"
                 "MOV     R1, #0xA\n"
                 "BL      sub_FF81BDFC\n"
                 "LDR     R7, =0x1D608\n"
                 "MOV     R4, #9\n"
                 "ADD     R9, R4, #0x2D4\n"
                 "STR     R0, [R5,#0x20]\n"
 "loc_FF858668:\n"
                 "RSB     R0, R4, R4,LSL#3\n"
                 "STR     R6, [R7,R0,LSL#2]\n"
                 "ADD     R1, R7, R0,LSL#2\n"
                 "STR     R9, [SP,#0x0]\n"
                 "LDR     R0, [R5,#0x20]\n"
                 "LDR     R3, =0xFF857794\n"
                 "MOV     R2, R8\n"
                 "BL      sub_FF81BF08\n"
                 "SUBS    R4, R4, #1\n"
                 "BPL     loc_FF858668\n"
                 "MOV     R3, #0\n"
                 "STR     R3, [SP,#0x0]\n"
                 "LDR     R3, =MovieRecord_Task_my\n"    
                 "MOV     R2, #0x1000\n"
                 "MOV     R1, #0x14\n"
                 "LDR     R0, =0xFF8587FC\n"
                 "BL      sub_FF81BDC8\n"
 "loc_FF8586AC:\n"
                 "BL      sub_FF9301C0\n"
                 "BL      sub_FF858710\n"
                 "MOV     R1, R0\n"
                 "MOV     R0, #0xB\n"
                 "ADD     R3, R0, #0x2DC\n"
                 "STR     R0, [R1]\n"
                 "STR     R3, [SP,#0x0]\n"
                 "LDR     R0, [R5,#0x1C]\n"
                 "LDR     R3, =0xFF857794\n"
                 "MOV     R2, R8\n"
                 "BL      sub_FF81BF08\n"
                 "LDMFD   SP!, {R3-R9,PC}\n"
 );
} 


void __attribute__((naked,noinline)) MovieRecord_Task_my(){ 	
 asm volatile(
                 "STMFD   SP!, {R2-R8,LR}\n"
                 "LDR     R8, =0x32B\n"
                 "LDR     R7, =0x2710\n"
                 "LDR     R4, =0x54E8\n"
                 "MOV     R6, #0\n"
                 "MOV     R5, #1\n"
 "loc_FF858504:\n"
                 "LDR     R0, [R4,#0x1C]\n"
                 "MOV     R2, #0\n"
                 "ADD     R1, SP, #0x4\n"
                 "BL      sub_FF8290D8\n"
                 "LDR     R0, [R4,#0x24]\n"
                 "CMP     R0, #0\n"
                 "BNE     loc_FF8585D4\n"
                 "LDR     R0, [SP,#0x4]\n"
                 "LDR     R1, [R0]\n"
                 "SUB     R1, R1, #2\n"
                 "CMP     R1, #9\n"
                 "ADDLS   PC, PC, R1,LSL#2\n"
                 "B       loc_FF8585D4\n"
 "loc_FF858538:\n"
                 "B       loc_FF858588\n"
 "loc_FF85853C:\n"
                 "B       loc_FF8585A8\n"
 "loc_FF858540:\n"
                 "B       loc_FF8585B8\n"
 "loc_FF858544:\n"
                 "B       loc_FF8585C0\n"
 "loc_FF858548:\n"
                 "B       loc_FF858590\n"
 "loc_FF85854C:\n"
                 "B       loc_FF8585C8\n"
 "loc_FF858550:\n"
                 "B       loc_FF858598\n"
 "loc_FF858554:\n"
                 "B       loc_FF8585D4\n"
 "loc_FF858558:\n"
                 "B       loc_FF8585D0\n"
 "loc_FF85855C:\n"
                 "B       loc_FF858560\n"
 "loc_FF858560:\n"
                 "LDR     R0, =0xFF8581AC\n"
                 "STR     R6, [R4,#0x38]\n"
                 "STR     R0, [R4,#0xA4]\n"
                 "LDR     R0, =0xFF857AE8\n"
                 "LDR     R2, =0xFF857A04\n"
                 "LDR     R1, =0x1D730\n"
                 "STR     R6, [R4,#0x28]\n"
                 "BL      sub_FF8C1FC0\n"
                 "STR     R5, [R4,#0x3C]\n"
                 "B       loc_FF8585D4\n"
 "loc_FF858588:\n"
                 "BL      unlock_optical_zoom\n" 
                 "BL      sub_FF8582A4\n"
                 "B       loc_FF8585D4\n"
 "loc_FF858590:\n"
                 "BL      sub_FF857F44_my\n"
                 "B       loc_FF8585D4\n"
 "loc_FF858598:\n"
                 "LDR     R1, [R0,#0x10]\n"
                 "LDR     R0, [R0,#4]\n"
                 "BL      sub_FF930DFC\n"
                 "B       loc_FF8585D4\n"
 "loc_FF8585A8:\n"
                 "LDR     R0, [R4,#0x3C]\n"
                 "CMP     R0, #5\n"
                 "STRNE   R5, [R4,#0x2C]\n"
                 "B       loc_FF8585D4\n"
 "loc_FF8585B8:\n"
                 "BL      sub_FF857CD4\n"
                 "B       loc_FF8585D4\n"
 "loc_FF8585C0:\n"
                 "BL      sub_FF857B34\n"
                 "B       loc_FF8585D4\n"
 "loc_FF8585C8:\n"
                 "BL      sub_FF857990\n"
                 "B       loc_FF8585D4\n"
 "loc_FF8585D0:\n"
                 "BL      sub_FF85873C\n"
 "loc_FF8585D4:\n"
                 "LDR     R1, [SP,#0x4]\n"
                 "STR     R6, [R1]\n"
                 "LDR     R3, =0xFF857794\n"
                 "MOV     R2, R7\n"
                 "STR     R8, [SP,#0x0]\n"
                 "LDR     R0, [R4,#0x20]\n"
                 "BL      sub_FF81BF08\n"
                 "B       loc_FF858504\n"
 );
} 


void __attribute__((naked,noinline)) sub_FF857F44_my(){ 		
 asm volatile(                                   	
                 "STMFD   SP!, {R4-R9,LR}\n"
                 "SUB     SP, SP, #0x3C\n"
                 "MOV     R7, #0\n"
                 "LDR     R5, =0x54E8\n"
                 "MOV     R4, R0\n"
                 "STR     R7, [SP,#0x2C]\n"
                 "STR     R7, [SP,#0x24]\n"
                 "LDR     R0, [R5,#0x3C]\n"
                 "MOV     R8, #4\n"
                 "CMP     R0, #3\n"
                 "STREQ   R8, [R5,#0x3C]\n"
                 "LDR     R0, [R5,#0xA4]\n"
                 "MOV     R6, #0\n"
           
                ".long   0xE12FFF30\n"
                 "LDR     R0, [R5,#0x3C]\n"
                 "CMP     R0, #4\n"
                 "BNE     loc_FF858054\n"
                 "LDRH    R0, [R5,#2]\n"
                 "MOV     R9, #1\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF857FC0\n"
                 "LDRH    R1, [R5,#4]\n"
                 "LDR     R0, [R5,#0x4C]\n"
                 "MUL     R0, R1, R0\n"
                 "MOV     R1, #0x3E8\n"
                 "BL      sub_FFA934CC\n"
                 "MOV     R1, R0\n"
                 "LDR     R0, [R5,#0x54]\n"
                 "BL      sub_FFA934CC\n"
                 "CMP     R1, #0\n"
                 "BNE     loc_FF857FDC\n"
 "loc_FF857FC0:\n"
                 "ADD     R3, SP, #0x24\n"
                 "ADD     R2, SP, #0x28\n"
                 "ADD     R1, SP, #0x2C\n"
                 "ADD     R0, SP, #0x30\n"
                 "BL      sub_FF930F90\n"
                 "MOVS    R6, R0\n"
                 "BNE     loc_FF857FF8\n"
 "loc_FF857FDC:\n"
                 "LDR     R0, [R5,#0x2C]\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF85805C\n"
                 "LDR     R0, [R5,#0x54]\n"
                 "LDR     R1, [R5,#0x40]\n"
                 "CMP     R0, R1\n"
                 "BCC     loc_FF85805C\n"
 "loc_FF857FF8:\n"
                 "CMP     R6, #0x80000001\n"
                 "STREQ   R8, [R5,#0x58]\n"
                 "BEQ     loc_FF858030\n"
                 "CMP     R6, #0x80000003\n"
                 "STREQ   R9, [R5,#0x58]\n"
                 "BEQ     loc_FF858030\n"
                 "CMP     R6, #0x80000005\n"
                 "MOVEQ   R0, #2\n"
                 "BEQ     loc_FF85802C\n"
                 "CMP     R6, #0x80000007\n"
                 "STRNE   R7, [R5,#0x58]\n"
                 "BNE     loc_FF858030\n"
                 "MOV     R0, #3\n"
 "loc_FF85802C:\n"
                 "STR     R0, [R5,#0x58]\n"
 "loc_FF858030:\n"
                 "LDR     R0, =0x1D760\n"
                 "LDR     R0, [R0,#8]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF858048\n"
                 "BL      sub_FF845BAC\n"
                 "B       loc_FF85804C\n"
 "loc_FF858048:\n"
                 "BL      sub_FF857990\n"
 "loc_FF85804C:\n"
                 "MOV     R0, #5\n"
                 "STR     R0, [R5,#0x3C]\n"
 "loc_FF858054:\n"
                 "ADD     SP, SP, #0x3C\n"
                 "LDMFD   SP!, {R4-R9,PC}\n"
 "loc_FF85805C:\n"
                 "LDR     R12, [SP,#0x2C]\n"
                 "CMP     R12, #0\n"
                 "BEQ     loc_FF858154\n"
                 "STR     R9, [R5,#0x30]\n"
                 "LDR     R0, [R5,#0x48]\n"
                 "CMP     R0, #4\n"
                 "LDRNE   LR, [R4,#0xC]\n"
                 "BNE     loc_FF85809C\n"
                 "LDR     R0, [R4,#0xC]\n"
                 "LDR     R1, [R4,#8]\n"
                 "MOV     R2, R0,LSR#3\n"
                 "MUL     R1, R2, R1\n"
                 "LDR     R2, [R4,#4]\n"
                 "SUB     LR, R0, R0,LSR#2\n"
                 "ADD     R1, R2, R1,LSL#1\n"
                 "STR     R1, [R4,#4]\n"
 "loc_FF85809C:\n"
                 "LDR     R0, [R5,#0x70]\n"
                 "LDR     R1, [R4,#0x14]\n"
                 "LDR     R2, [R4,#0x18]\n"
                 "ADD     R3, SP, #0x34\n"
                 "ADD     R6, SP, #0x14\n"
                 "STMIA   R6, {R0-R3}\n"
                 "LDR     R0, [SP,#0x24]\n"
                 "LDR     R3, [R5,#0x5C]\n"
                 "LDR     R1, [SP,#0x28]\n"
                 "ADD     R2, SP, #0x38\n"
                 "ADD     R6, SP, #0x8\n"
                 "STMIA   R6, {R0,R2,R3}\n"
                 "STR     R1, [SP,#0x4]\n"
                 "STR     R12, [SP,#0x0]\n"
                 "LDMIB   R4, {R0,R1}\n"
                 "LDR     R3, [SP,#0x30]\n"
                 "MOV     R2, LR\n"
                 "BL      sub_FF8EDA04\n"
                 "LDR     R0, [R5,#0x14]\n"
                 "MOV     R1, #0x3E8\n"
                 "BL      sub_FF81B98C\n"
                 "CMP     R0, #9\n"
                 "BNE     loc_FF858108\n"
                 "BL      sub_FF93156C\n"
                 "MOV     R0, #0x90000\n"
                 "STR     R9, [R5,#0x3C]\n"
                 "B       loc_FF858120\n"
 "loc_FF858108:\n"
                 "LDR     R0, [SP,#0x34]\n"
                 "CMP     R0, #0\n"
                 "BEQ     loc_FF858128\n"
                 "BL      sub_FF93156C\n"
                 "MOV     R0, #0xA0000\n"
                 "STR     R9, [R5,#0x3C]\n"
 "loc_FF858120:\n"
                 "BL      sub_FF86D65C\n"
                 "B       loc_FF858054\n"
 "loc_FF858128:\n"
                 "BL      sub_FF8EDAC8\n"
                 "LDR     R0, [SP,#0x30]\n"
                 "LDR     R1, [SP,#0x38]\n"
                 "BL      sub_FF931314\n"
                 "LDR     R0, [R5,#0x50]\n"
                 "LDR     R1, =0x5558\n"
                 "ADD     R0, R0, #1\n"
                 "STR     R0, [R5,#0x50]\n"
                 "LDR     R0, [SP,#0x38]\n"
                 "MOV     R2, #0\n"
                 "BL      sub_FF92F134_my\n"
 "loc_FF858154:\n"
                 "LDR     R0, [R5,#0x54]\n"
                 "ADD     R0, R0, #1\n"
                 "STR     R0, [R5,#0x54]\n"
                 "LDR     R1, [R5,#0x7C]\n"
                 "MUL     R0, R1, R0\n"
                 "LDR     R1, [R5,#0x78]\n"
                 "BL      sub_FFA934CC\n"
                 "MOV     R4, R0\n"
                 "BL      sub_FF9315A4\n"
                 "LDR     R1, [R5,#0x74]\n"
                 "CMP     R1, R4\n"
                 "BNE     loc_FF858190\n"
                 "LDR     R0, [R5,#0x34]\n"
                 "CMP     R0, #1\n"
                 "BNE     loc_FF8581A4\n"
 "loc_FF858190:\n"
                 "LDR     R1, [R5,#0x88]\n"
                 "MOV     R0, R4\n"
                  
                ".long   0xE12FFF31\n"
                 "STR     R4, [R5,#0x74]\n"
                 "STR     R7, [R5,#0x34]\n"
 "loc_FF8581A4:\n"
                 "STR     R7, [R5,#0x30]\n"
                 "B       loc_FF858054\n"
 );
} 


void __attribute__((naked,noinline)) sub_FF92F134_my(){ 
 asm volatile(
                 "STMFD   SP!, {R4-R8,LR}\n"
                 "LDR     R4, =0xE00C\n"
                 "LDR     LR, [R4]\n"
                 "LDR     R2, [R4,#8]\n"
                 "CMP     LR, #0\n"
                 "LDRNE   R3, [R4,#0xC]\n"
                 "MOV     R5, R2\n"
                 "CMPNE   R3, #1\n"
                 "MOVEQ   R2, #0\n"
                 "STREQ   R0, [R4]\n"
                 "STREQ   R2, [R4,#0xC]\n"
                 "BEQ     loc_FF92F200\n"
                 "LDR     R3, [R4,#4]\n"
                 "LDR     R7, =table\n"          
                 "ADD     R12, R3, R3,LSL#1\n"
                 "LDR     R3, [R7,R12,LSL#2]\n"
                 "ADD     R6, R7, #0x60\n"
                 "LDR     R8, [R6,R12,LSL#2]\n"
                 "SUB     R3, LR, R3\n"
                 "CMP     R3, #0\n"
                 "SUB     LR, LR, R8\n"
                 "BLE     loc_FF92F1BC\n"
                 "ADD     R12, R7, R12,LSL#2\n"
                 "LDR     LR, [R12,#4]\n"
                 "CMP     LR, R3\n"
                 "ADDGE   R2, R2, #1\n"
                 "BGE     loc_FF92F1B0\n"
                 "LDR     R12, [R12,#8]\n"
                 "CMP     R12, R3\n"
                 "ADDLT   R2, R2, #3\n"
                 "ADDGE   R2, R2, #2\n"
 "loc_FF92F1B0:\n"
       
       
                 "CMP     R2, #0x1A\n"   
                 "MOVGE   R2, #0x19\n"   
                 "B       loc_FF92F1F0\n"
 "loc_FF92F1BC:\n"
                 "CMP     LR, #0\n"
                 "BGE     loc_FF92F1F0\n"
                 "ADD     R3, R6, R12,LSL#2\n"
                 "LDR     R12, [R3,#4]\n"
                 "CMP     R12, LR\n"
                 "SUBLE   R2, R2, #1\n"
                 "BLE     loc_FF92F1E8\n"
                 "LDR     R3, [R3,#8]\n"
                 "CMP     R3, LR\n"
                 "SUBGT   R2, R2, #3\n"
                 "SUBLE   R2, R2, #2\n"
 "loc_FF92F1E8:\n"
                 "CMP     R2, #0\n"
                 "MOVLT   R2, #0\n"
 "loc_FF92F1F0:\n"
                 "CMP     R2, R5\n"
                 "STRNE   R2, [R4,#8]\n"
                 "MOVNE   R2, #1\n"
                 "STRNE   R2, [R4,#0xC]\n"
 "loc_FF92F200:\n"
                 "LDR     R2, =CompressionRateTable\n"
                 "LDR     R3, [R4,#8]\n"
                 "LDR     R2, [R2,R3,LSL#2]\n"

                 "LDR     R3, =video_mode\n"      
                 "LDR     R3, [R3]\n"             
                 "LDR     R3, [R3]\n"             
                 "CMP     R3, #1\n"               
                 "LDREQ   R3, =video_quality\n"   
                 "LDREQ   R3, [R3]\n"             
                 "LDREQ   R2, [R3]\n"             

                 "STR     R2, [R1]\n"
                 "STR     R0, [R4]\n"
           
                 "LDMFD   SP!, {R4-R8,PC}\n"
 );
} 

#include "conf.h"

int *video_quality = &conf.video_quality;
int *video_mode    = &conf.video_mode;

long def_table[48]={
 0x2000,  0x38D,  0x788,   0x5800, 0x9C5,  0x14B8,  0x10000, 0x1C6A,  0x3C45,  0x20000, 0x387A,  0x7813,
 0x25800, 0x422F, 0x8CB6,  0x8000, 0xE35,  0x1E23,  0x10000, 0x1C6A,  0x3C45,  0x12C00, 0x2118,  0x465B,
 0x1CCD, -0x2E1,  -0x579,  0x4F33, -0x7EB, -0xF0C,  0xE666,  -0x170A, -0x2BC6, 0x1CC39, -0x2F5B, -0x59F0,
 0x21B53,-0x377F, -0x6965, 0x7333, -0xB85, -0x15E3, 0xE666,  -0x170A, -0x2BC6, 0x10DAA, -0x1BC0, -0x34B3
};

long table[48];

void change_video_tables(int a, int b){
 int i;
 for (i=0; i<48; i++) table[i]=(def_table[i]*a)/b; 
}

long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
